//---------------------------------------------------------------------------

#include "vcl_stl.h"
#pragma hdrstop

#include "h_base.h"
#include "h_xml.h"
#include "h_global.h"
using namespace h_base;
using namespace h_xml;

#include "h_stage.h"
#include "t_dummyform.h"

#include "t_eventwaitform.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TEventWaitForm *EventWaitForm;
//---------------------------------------------------------------------------
__fastcall TEventWaitForm::TEventWaitForm(TComponent* Owner)
   : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TEventWaitForm::ButtonOkClick(TObject *Sender)
{
   Close();
}
//---------------------------------------------------------------------------


bool __fastcall TEventWaitForm::Edit(HStageEventWait *Stage)
{
   FStage = Stage;
   FStage->GetInfo(Info);
   UTF8String Cap;
   Cap.sprintf(UTF8String(DummyForm->PropertiesOf->Caption).c_str(), "event wait");
   Caption = Cap;
   EditName->Text = Info.Name;
   EditEvent->Text = Info.Event;
   EditWaitForFile->Text = Info.WaitForFile;
   EditWaitForTime->Text = Info.WaitForTime;
   EditWaitForCommand->Text = Info.WaitForCommand;
   CheckBoxWaitForOperator->Checked = Info.WaitForOperator;
   SetStringToMemo(MemoDescription, Info.Description);
   SetStringToMemo(MemoExternJobList, Info.ExternJobListStr);
   EditSpecialDate->Text = Info.SpecialDate;
   CheckBoxCondNot->Checked = Info.CondNot;
   EditConditionFile->Text = Info.ConditionFile;
   EditJobTrigger->Text = Info.JobTrigger;
   EditPriority->Text = Info.Priority;
   EditAutoRerun->Text = Info.AutoRerun;
   EditTag->Text = Info.Tag;
   EditStatus->Text = Info.Status;
   EditStartTime->Text = FormatDateTime(Info.StartTime);
   EditEndTime->Text = FormatDateTime(Info.EndTime);
   EditElapse->Text = DiffTime(Info.StartTime, Info.EndTime, Info.IdleTimeSum);
   EditServerId->Text = ( Info.ServerId == 0 ? UTF8String("") : UTF8String(Info.ServerId) );
   EditPid->Text = ( Info.Pid == 0 ? UTF8String("") : UTF8String(Info.Pid) );
   ShowModal();
   return true;
}

